Skip to main content

Plot

Wolfram Kernel
Execution environment

A Swiss knife for displaying 2D data

Plot[expr_, {variable, min, max, step}, opts__]

has HoldFirst attribute. See the list of supported options (opts) down below

Options​

PlotStyle​

Works as in Mathematica, i.e. per element in expr array, supports color, opacity and etc

Plot[Table[x^y, {y, 6}]//Evaluate, {x, 0,1}, PlotStyle->Table[Blend[{Red, Blue}, i/6], {i, 6}]]

AxesLabel​

Place labels on your axes

Plot[Sinc[x], {x, 0, 10}, AxesLabel -> {"x", "Sinc[x]"}]

Labels accepts only strings or numbers unlike Mathematica, where you can put everything.

Since it is translated into Text, one can use sort of TeX math input

Plot[PDF[NormalDistribution[0, 1], x], {x, -10, 10}, AxesLabel -> {"wavenumber (cm^{-1})", "absorption \\alpha"}, PlotRange->Full]

It also supports Offset attribute

Plot[PDF[NormalDistribution[0, 1], x], {x, -10, 10}, AxesLabel -> {Offset["wavenumber (cm^{-1})", {0,0.05}], "absorption \\alpha"}, PlotRange->Full]

Ticks​

Customize ticks by providing an array of numbers for both axes

Plot[x, {x, 0, 1}, Ticks->{{0, 0.5, 1}, {}}]

Or by providing as pairs {Number, String} one can specify the displayed text

Plot[x, {x, 0, 1}, Ticks->{{{0, "Zero"}, {0.5, "Half"}, {1,"One"}}, {}}]

Controls πŸ’›β€‹

This is more an option for Graphics, but with a bit of a hacking it can be used here as well. The features allows to pan and zoom your plots, that was never possible in Mathematica

Plot[Sin[1/x], {x, 0.001, 0.1}, MaxRecursion->1];
Insert[%, Controls->True, {2,-1}]

Try to use your mouse here

Frame​

Turns plot into the journals-like styled graph. In general it has much more options to customize the look

Plot[x, {x, 0, 1}, Frame->True]

FrameTicks​

The same as Ticks, but for this regime.

FrameLabels​

The same as AxesLabel

Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{"x-axis", "y-axis"}]

FrameStyle​

Affects the style of FrameLabels. Use Directive for changing the style

Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{"x-axis", "y-axis"}, FrameStyle->Directive[FontSize->16]]

FrameTicksStyle​

Affects the style of FrameTicks

Plot[x, {x, 0, 1}, Frame->True, FrameLabel->{"x-axis", "y-axis"}, FrameTicksStyle->Directive[FontSize->16]]

TickLabels​

info

Since Plot options are hardcoded in WL core, we cannot add new options, however using trick with Insert any values can be provided to the resulting Graphics expression

To remove unnecessary ticks, use

Plot[x, {x, 0, 1}, Frame->True];
Insert[%, "TickLabels"->{{True, False}, {True, False}}, {2,-1}]

ClippingStyle​

Show the clipped regions like the rest of the curve and colored

Plot[Sin[x]/x^2, {x, -10, 10}, ClippingStyle -> Red]

Filling​

Fill the area under, over of between curves

Plot[Evaluate[Table[BesselJ[n, x], {n, 4}]], {x, 0, 10}, Filling -> Axis]

Possible options will be

  • Bottom
  • Top
  • {1 -> {2}} from curve 1 to 2

Baseline​

Align graphs by theΒ xxΒ axis in each plot:

{Plot[Im[Zeta[1/2 + I t]], {t, -20, 20}, BaselinePosition -> Axis], 
Plot[Re[Zeta[1/2 + I t]], {t, -20, 20}, BaselinePosition -> Axis]} // Row

Epilog​

Puts any graphics object on top of the data plotted

Plot[Sin[x], {x, 0, 2 Pi}, Epilog -> {PointSize[0.04], Point[{0, 0}], Point[{Pi, 0}], Point[{2 Pi, 0}]}]

It opens up many possibilities, since it provides low-level access to the Graphics canvas.

Prolog​

The same as Epilog, but acts before plotting the data.

ExclusionsStyle​

Use red lines to indicate the vertical asymptotes

Plot[Tan[x], {x, 0, 10}, Exclusions -> {Cos[x] == 0}, 
ExclusionsStyle -> Red]

ImageSize​

A common option for any graphics

ImageSize -> Width

or

ImageSize -> {Width, Height}

It uses pixels as units

MaxReqursion​

Affects the accuracy of the plot when it comes to the sudden changes of a sampled function

Plot[Sin[1/x], {x, 0.001, 0.1}, MaxRecursion->1]

The lowest values is 0

Mesh​

Shows sampling points

Plot[Sin[1/x], {x, 0.001, 0.1}, Mesh -> All]

PeformanceGoal​

Affects the number of sampling points to reduce the load

  • "Speed"
  • "Quality"

PlotPoints​

Change the initial sampling points

  • a number

PlotLegends​

Is quite limited. Accepts Automatic, "Expressions" or List of expressions to show

PlotRange​

Change the lot range to show the whole area

Plot[Sqrt[x], {x, -5, 5}, PlotRange -> Full]

Or a custom range

Plot[Sqrt[x], {x, -5, 5}, PlotRange -> {{-5,5}, {0,1}}]

RegionFunction​

Show the specific area only

Plot[Sin[x], {x, 0, 8 Pi}, RegionFunction -> Function[{x, y}, Abs[y] > 0.5]]

Axes​

caution

Currently is not supported by Graphics ;(

Show or hide axes of the plot

Plot[Sinc[x], {x, 0, 10}, Axes -> False]